pathMembership <- function(net,spanners,nodes){
	require(igraph)
	grph <- graph.adjacency(net)
	onPaths <- numeric(length(spanners))
	pathsList <- list()
	ind <- 1
	for(i in 2:length(nodes)){
		for(j in 1:(i-1)){
			pathsij <- get.all.shortest.paths(grph,nodes[i],nodes[j])$res
			pathsList[[ind]] <- pathsij
			ind <- ind + 1 
		}
	}
	for(i in 1:length(spanners)){
			for(j in 1:length(pathsList)){
				allonpath <- c(unlist(pathsList[[j]]))
				if(length(allonpath)>0){
				onPaths[i] <- onPaths[i] + length(which(allonpath==spanners[i]))/length(pathsList[[j]])
				}
			}
			#print(i)
	}
	detach(package:igraph)
	onPaths
}
